<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">
        <title>我的红包</title>
        <link href="__MZUI__/css/admin.css" rel="stylesheet" type="text/css">
        <link href="__MZUI__/css/amazeui.css" rel="stylesheet" type="text/css">
        <link href="__CSS__/user/personal.css" rel="stylesheet" type="text/css">
        <link href="__CSS__/user/cpstyle.css" rel="stylesheet" type="text/css">
        <link href="__CSS__/common.css" rel="stylesheet" type="text/css">
        <script type="text/javascript" src="__JQ__"></script>
        <script src="__MZUI__/js/amazeui.js"></script>
        <script type="text/javascript" src="__LY__"></script>
        <script type="text/javascript" src="__JS__/public.lib.js"></script>
    </head>

    <body>
        <!--头 -->
    <include file="Include/top" />
    <include file="Include/header" />
    <div class="center">
        <div class="col-main">
            <div class="main-wrap">

                <div class="user-coupon">
                    <!--标题 -->
                    <div class="am-cf am-padding">
                        <div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">优惠券</strong> / <small>Coupon</small></div>
                    </div>
                    <hr/>

                    <div class="am-tabs-d2 am-tabs  am-margin" data-am-tabs>

                        <ul class="am-avg-sm-2 am-tabs-nav am-nav am-nav-tabs">
                            <li class="am-active"><a href="#tab1">可用优惠券</a></li>
                            <li><a href="#tab2">已用/过期优惠券</a></li>

                        </ul>

                        <div class="am-tabs-bd">
                            <div class="am-tab-panel am-fade am-in am-active" id="tab1">
                                <div class="coupon-items">
                                    <foreach item="v" name="voucher">
                                        <div class="coupon-item coupon-item-d">
                                            <div class="coupon-list">
                                                <div class="c-type">
                                                    <div class="c-class">
                                                        <empty name="v['voucher_store_id']">
                                                            <strong>通用券</strong>
                                                            <else />
                                                            <strong>店铺券</strong>
                                                        </empty>
                                                    </div>
                                                    <div class="c-price"><strong>￥{$v['voucher_price']}</strong></div>
                                                    <div class="c-limit">【消费满&nbsp;{$v['voucher_limit']}元&nbsp;可用】</div>
                                                    <div class="c-time"><a href="{:HOME_URL}/Supplier/{$v['voucher_store_id']}" target="_blank" title="{$v['voucher_storename']}">{$v['voucher_storename']}</a></div>
                                                    <div class="c-type-top"></div>
                                                    <div class="c-type-bottom"></div>
                                                </div>
                                                <div class="c-msg">
                                                    <div class="c-range">
                                                        <div class="range-all">
                                                            <div class="range-item">
                                                                <span class="txt">开始：{$v['voucher_start_date']|date="Y-m-d H:i:s",###}</span>
                                                            </div>
                                                            <div class="range-item">
                                                                <span class="txt">结束：{$v['voucher_end_date']|date="Y-m-d H:i:s",###}</span>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="op-btns">
                                                        <empty name="v['voucher_store_id']">
                                                            <a href="{:HOME_URL}" class="btn"><span class="txt">立即使用</span><b></b></a>
                                                            <else />
                                                            <a href="{:HOME_URL}/Supplier/{$v['voucher_store_id']}" class="btn"><span class="txt">立即使用</span><b></b></a>
                                                        </empty>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </foreach>
                                </div>
                            </div>

                            <div class="am-tab-panel am-fade" id="tab2">
                                <div class="coupon-items">
                                    <foreach item="v" name="evoucher">
                                        <div class="coupon-item coupon-item-d">
                                            <div class="coupon-list">
                                                <div class="c-type">
                                                    <div class="c-class">
                                                        <empty name="v['voucher_store_id']">
                                                            <strong>通用券</strong>
                                                            <else />
                                                            <strong>店铺券</strong>
                                                        </empty>
                                                        <span class="am-icon-trash"></span>
                                                    </div>
                                                    <div class="c-price">
                                                        <strong>￥{$v['voucher_price']}</strong>
                                                    </div>
                                                    <div class="c-limit">【消费满&nbsp;{$v['voucher_limit']}元&nbsp;可用】</div>
                                                    <div class="c-time"><a href="{:HOME_URL}/Supplier/{$v['voucher_store_id']}" target="_blank" title="{$v['voucher_storename']}">{$v['voucher_storename']}</a></div>
                                                    <div class="c-type-top"></div>
                                                    <div class="c-type-bottom"></div>
                                                </div>

                                                <div class="c-msg">
                                                    <div class="c-range">
                                                        <div class="range-all">
                                                            <div class="range-item">
                                                                <span class="txt">开始：{$v['voucher_start_date']|date="Y-m-d H:i:s",###}</span>
                                                            </div>
                                                            <div class="range-item">
                                                                <span class="txt">结束：{$v['voucher_end_date']|date="Y-m-d H:i:s",###}</span>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="op-btns c-del">
                                                        <a href="javascript:void(0);" class="btn" onclick="delClick({$v['voucher_id']});"><span class="txt">删除</span><b></b></a>
                                                    </div>
                                                </div>

                                                <li class="td td-usestatus ">
                                                    <div class="item-usestatus ">
                                                        <if condition="$v['voucher_state'] eq 2">
                                                            <span><img src="__IMG__/user/gift_stamp_31.png"</span>
                                                            <elseif condition="$v['voucher_state'] eq 3" />
                                                            <span><img src="__IMG__/user/gift_stamp_21.png"</span>
                                                        </if>
                                                    </div>
                                                </li>												
                                            </div>
                                        </div>
                                    </foreach>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <include file="Include/navigation" />
    </div>
    <include file="Include/footer" />
</body>
</html>
<script type="text/javascript">
    function delClick(voucher_id) {
        layer.confirm('确认取消吗？', {
            btn: ['确认', '算了'] //按钮
        }, function () {
            var data = {voucher_id: voucher_id};
            p = Aajax("{:U('/Coupon/delCoupon')}", data);
            if (p.status) {
                layer.msg(p.info);
                window.location.reload();
            } else {
                layer.msg(p.info);
            }
        });
    }
</script>